<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="949.43">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 15.0px Helvetica}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 16.0px Helvetica}
p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco; color: #5b6828; min-height: 16.0px}
p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco}
p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco; color: #0c2daa}
p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco; color: #722d2e}
p.p9 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco; min-height: 16.0px}
p.p10 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco; color: #1130a5}
p.p11 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco; color: #683031}
p.p12 {margin: 0.0px 0.0px 0.0px 0.0px; font: 16.0px Helvetica; min-height: 19.0px}
span.s1 {font: 18.0px Helvetica}
span.s2 {color: #0000ff}
span.s3 {color: #0c2daa}
span.s4 {color: #576922}
span.s5 {color: #000000}
span.s6 {color: #1130a5}
span.s7 {color: #5b6828}
span.s8 {color: #683031}
span.s9 {color: #606060}
span.Apple-tab-span {white-space:pre}
</style>
</head>
<body>
<p class="p1"><span class="s1"><b>ProcMod<span class="Apple-tab-span">	</span>/ ProcEvents<span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span></b></span><b>A real-time control structure!</b></p>
<p class="p2"><br></p>
<p class="p3"><b>ProcMod - A structure for controlling modular processes.</b></p>
<p class="p3"><b>ProcEvents - An event manager for ProcMod with GUI control capabilities.</b></p>
<p class="p2"><br></p>
<p class="p3">SEE ALSO: <a href="ProcModR.html"><span class="s2">ProcModR</span></a> - even cooler then ProcMod.</p>
<p class="p2"><br></p>
<p class="p4"><b>ProcMod</b></p>
<p class="p2"><br></p>
<p class="p3"><b>Class Methods</b></p>
<p class="p2"><br></p>
<p class="p3"><b>*new(env, amp, id, group, addAction, target, function, releaseFunc, onReleaseFunc, responder,</b></p>
<p class="p3"><b><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>timeScale, lag, clock, server)</b></p>
<p class="p3"><b>*play(env, amp, id, group, addAction, target, function, releaseFunc, onReleaseFunc, responder,</b></p>
<p class="p3"><b><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>timeScale, lag, clock, server)</b></p>
<p class="p2"><br></p>
<p class="p3"><span class="Apple-tab-span">	</span><b>env - </b>an overall amplitude envelope that synths created in a ProcMod function can access. This will run</p>
<p class="p3"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>a .kr env on ProcMod.envbus that can be read by other synths in the ProcMod through the creation</p>
<p class="p3"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>of a procmodenv synth. There is a max of 20 breakpoints to the env. If the Env has a releaseNode,</p>
<p class="p3"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>ProcMod will continue to process events until .release is called.</p>
<p class="p3"><span class="Apple-tab-span">	</span><b>amp - </b>an overall amplitude control for an instance of ProcMod.</p>
<p class="p3"><span class="Apple-tab-span">	</span><b>id - </b>a \symbol or "string" to be used later to identify an instance of ProcMod.</p>
<p class="p3"><span class="Apple-tab-span">	</span><b>group - </b>a group for an instance of ProcMod to run in. Defaults to nil and a new group is created. If<span class="Apple-converted-space"> </span></p>
<p class="p3"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>ProcMod creates the group, a new one is created on each .play call.</p>
<p class="p3"><b><span class="Apple-tab-span">	</span>addAction - </b>an addAction for this instance of ProcMod. Defaults to 0.</p>
<p class="p3"><span class="Apple-tab-span">	</span><b>target -</b> a target for this instance of ProcMod. Defaults to 1.</p>
<p class="p3"><span class="Apple-tab-span">	</span><b>function</b> - a Function, Task or Routine to be evaluated on the playing of this instance of ProcMod.</p>
<p class="p3"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>If a Function is passed in that returns a Task or Routine, the ProcMod will become 're-triggerable'</p>
<p class="p3"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>and will allow for overlapping getures (it can be released and restarted immediately). All Functions,</p>
<p class="p3"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>when evaluated, will have the current group id and envbus passed in as an argument.</p>
<p class="p3"><span class="Apple-tab-span">	</span><b>releaseFunc</b> - a Function, Task or Routine to be evaluated after the ProcMod has finished its release</p>
<p class="p3"><span class="Apple-tab-span">	</span><b>onReleaseFunc</b> - a Function, Task or Routine to be evaluated at release time.</p>
<p class="p3"><span class="Apple-tab-span">	</span><b>responder</b> -<span class="Apple-converted-space">  </span>an instance of OSCresponder or OSCresponderNode for use by this instance<span class="Apple-converted-space"> </span></p>
<p class="p3"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>of ProcMod. It is automatically added when the ProcMod starts, and released after the ProcMod</p>
<p class="p3"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>finishes its release.</p>
<p class="p3"><span class="Apple-tab-span">	</span><b>timeScale -</b> applies a scale function to the ProcMod envelope. Defaults to 1.</p>
<p class="p3"><span class="Apple-tab-span">	</span><b>lag -</b> applies to chages to the amp value passed into this instance of ProcMod.</p>
<p class="p3"><span class="Apple-tab-span">	</span><b>clock -</b> an intance of Clock to run this instance of ProcMod. Defaults to SystemClock.</p>
<p class="p3"><span class="Apple-tab-span">	</span><b>server -</b> an instance of Server to run this ProcMod on. Useful for remote servers.<span class="Apple-converted-space"> </span></p>
<p class="p3"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>Defaults to Server.default.</p>
<p class="p2"><br></p>
<p class="p3"><b>Instance methods</b></p>
<p class="p2"><br></p>
<p class="p3"><b>play - </b>evaluates this instance of ProcMod. ProcMod.function is evaluated,<span class="Apple-converted-space"> </span></p>
<p class="p3"><span class="Apple-tab-span">	</span>and ProcMod.responder is set up if they are declared.<span class="Apple-converted-space"> </span></p>
<p class="p2"><span class="Apple-tab-span">	</span></p>
<p class="p3"><b>value - </b>same as .play.</p>
<p class="p2"><br></p>
<p class="p3"><b>release - </b>releases an instance of ProcMod. If ProcMod.env has a release section, functions and</p>
<p class="p3"><span class="Apple-tab-span">	</span>OSCresponders wait until this has executed before releasing the ProcMods functionality.</p>
<p class="p2"><span class="Apple-tab-span">	</span></p>
<p class="p3"><b>kill - </b>immediately free the ProcMod, regardless of ProcMod.env.</p>
<p class="p2"><br></p>
<p class="p3"><b>group -</b> return the current group of this instance of ProcMod.</p>
<p class="p2"><br></p>
<p class="p3"><b>envbus - </b>return the current control bus id the global envelope is written to for this instance of ProcMod.</p>
<p class="p2"><span class="Apple-tab-span">	</span></p>
<p class="p3"><b>env_( Env or Number) -</b> an instance of Env to be sent to the synthdef controlling an instance of ProcMods<span class="Apple-converted-space"> </span></p>
<p class="p3"><span class="Apple-tab-span">	</span>overall amplitude and event control. If a Number is passed in, it will represent a releasetime for the<span class="Apple-converted-space"> </span></p>
<p class="p3"><span class="Apple-tab-span">	</span>ProcMod.</p>
<p class="p2"><span class="Apple-tab-span">	</span></p>
<p class="p3"><b>function_( func ) </b>- an instance of Function, Task or Routine to be evaluated on ProcMod.play. If a Function is<span class="Apple-converted-space"> </span></p>
<p class="p3"><span class="Apple-tab-span">	</span>passed in, the ProcMod will become 're-triggerable' and can be restarted after it has been released. If</p>
<p class="p3"><span class="Apple-tab-span">	</span>a Function is passed in, it may return a Task or Routine. The function is passed the ProcMod's current</p>
<p class="p3"><span class="Apple-tab-span">	</span>group and envbus as args.</p>
<p class="p2"><br></p>
<p class="p3"><b>releaseFunc_( func )<span class="Apple-converted-space"> </span></b> - an instance of Function, Task or Routine to be evaluated after a ProcMod has released.</p>
<p class="p2"><br></p>
<p class="p3"><b>onReleaseFunc_( func )<span class="Apple-converted-space"> </span></b> - an instance of Function, Task or Routine to be evaluated the moment a ProcMod is</p>
<p class="p3"><span class="Apple-converted-space"> <span class="Apple-tab-span">	</span></span>released.</p>
<p class="p2"><br></p>
<p class="p3"><b>responder_( OSCresponder) </b>- an instance of OSCresponder or OSCresponderNode for use by an instance<span class="Apple-converted-space"> </span></p>
<p class="p3"><span class="Apple-tab-span">	</span>of ProcMod.</p>
<p class="p2"><br></p>
<p class="p3"><b>amp_( val ) -<span class="Apple-converted-space"> </span></b> If there is an envelope controlling the overall amplitude of events, set the amplitude to val.</p>
<p class="p2"><br></p>
<p class="p3"><b>lag_( val ) -<span class="Apple-converted-space"> </span></b> If there is an envelope controlling the overall amplitude of events, set the lag time for changes of<span class="Apple-converted-space"> </span></p>
<p class="p3"><span class="Apple-tab-span">	</span>amplitude to take effect (with the amp_ instance method)</p>
<p class="p2"><span class="Apple-tab-span">	</span></p>
<p class="p3"><b>saveToata( Association ) -<span class="Apple-converted-space"> </span><i> </i></b>places the Association into a Dictionary for later access. Any Association may be<span class="Apple-converted-space"> </span></p>
<p class="p3"><span class="Apple-tab-span">	</span>stored.<span class="Apple-converted-space"> </span></p>
<p class="p2"><br></p>
<p class="p3"><b>Examples:</b></p>
<p class="p5"><br></p>
<p class="p6"><span class="s3">SynthDef</span>(<span class="s4">\singrain</span>, {<span class="s3">arg</span> freq, amp, dur, envbus;</p>
<p class="p7"><span class="s5"><span class="Apple-tab-span">	</span></span>OffsetOut<span class="s5">.ar(0,<span class="Apple-converted-space"> </span></span></p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s3">Pan2</span>.ar(</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s3">SinOsc</span>.ar(freq, 0, amp) *<span class="Apple-converted-space"> </span></p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s3">EnvGen</span>.kr(<span class="s3">Env</span>.sine(dur, amp), doneAction: 2) *</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s3">In</span>.kr(envbus),</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s3">Rand</span>.new(-1.0, 1.0)</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>)</p>
<p class="p8"><span class="s5"><span class="Apple-tab-span">	</span>) </span>// read off the overall env control of the ProcMod</p>
<p class="p6">}).load(s);</p>
<p class="p9"><span class="Apple-tab-span">	</span></p>
<p class="p8">// create a new proc mod, and assign a function to it</p>
<p class="p6">a = <span class="s3">ProcMod</span>.new(<span class="s3">Env</span>([0, 1, 0], [1, 1], <span class="s4">\sin</span>, 1), server: s);</p>
<p class="p6">a.function_({<span class="s3">arg</span> group, envbus, server;</p>
<p class="p7"><span class="s5"><span class="Apple-tab-span">	</span></span>Task<span class="s5">({</span></p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s3">inf</span>.do({</p>
<p class="p8"><span class="s5"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span></span>// start a new synth... run it inside this ProcMod's group,</p>
<p class="p8"><span class="s5"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span></span>// and read control values off the envbus</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>server.sendMsg(<span class="s4">\s_new</span>, <span class="s4">\singrain</span>, server.nextNodeID, 0, group,</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s4">\freq</span>, 440.rrand(1760), <span class="s4">\amp</span>, 0.1, <span class="s4">\dur</span>, 5, <span class="s4">\envbus</span>, envbus);</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>0.5.wait;</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>})</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>});</p>
<p class="p6"><span class="Apple-tab-span">	</span>});</p>
<p class="p9"><br></p>
<p class="p8">// play it</p>
<p class="p6">a.play;</p>
<p class="p8">// change the amp</p>
<p class="p6">a.amp_(2);</p>
<p class="p8">// change the lag</p>
<p class="p6">a.lag_(0.5);</p>
<p class="p8">// change the amp again</p>
<p class="p6">a.amp_(5);</p>
<p class="p8">// release it</p>
<p class="p6">a.release;</p>
<p class="p9"><br></p>
<p class="p8">// creating ProcMods in a functional way</p>
<p class="p9"><br></p>
<p class="p6">a = {<span class="s3">arg</span> amp, env, high, low, winsize, overlaps;</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="s3">var</span> proc;</p>
<p class="p8"><span class="s5"><span class="Apple-tab-span">	</span></span>// defaults to Server.default if no Server is supplied</p>
<p class="p6"><span class="Apple-tab-span">	</span>proc = <span class="s3">ProcMod</span>.new(env, amp);</p>
<p class="p6"><span class="Apple-tab-span">	</span>proc.function_({<span class="s3">arg</span> group, envbus, server;</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s3">Task</span>({</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s3">inf</span>.do({</p>
<p class="p8"><span class="s5"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span></span>// start a new synth... run it inside this ProcMod's group,</p>
<p class="p8"><span class="s5"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span></span>// and read control values off the envbus</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>server.sendMsg(<span class="s4">\s_new</span>, <span class="s4">\singrain</span>, server.nextNodeID, 0, group,</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s4">\freq</span>, high.rrand(low), <span class="s4">\amp</span>, 1, <span class="s4">\dur</span>, winsize,<span class="Apple-converted-space"> </span></p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s4">\envbus</span>, envbus);</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>(winsize / overlaps).wait;</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>})</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>});</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>});</p>
<p class="p6"><span class="Apple-tab-span">	</span>};</p>
<p class="p9"><br></p>
<p class="p8">// create new instances of ProcMod... store it to the variables 'b' and 'c'</p>
<p class="p6">b = a.value(0.2, <span class="s3">Env</span>([0, 1, 0], [1, 1], <span class="s4">\sin</span>, 1), 2000, 1000, 0.1, 4);</p>
<p class="p6">c = a.value(0.3, <span class="s3">Env</span>([0, 1, 0], [10, 0.1], [5, -10], 1), 440, 880, 0.4, 2);</p>
<p class="p9"><br></p>
<p class="p6">b.play; c.play;</p>
<p class="p9"><br></p>
<p class="p6">b.release;<span class="Apple-converted-space"> </span></p>
<p class="p6">c.release;</p>
<p class="p9"><br></p>
<p class="p3"><b>Re-triggerable ProcMods</b></p>
<p class="p2"><br></p>
<p class="p3">ProcMods are meant for the most part, to be played and released. However, if the function slot is passed a Function object, they can be re-triggered after they have been released. If the Function returns a Task or Routine, the ProcMod will function as though a Task or Routine were placed in the function slot (it will be started and released in the same way). Re-triggered events will be assigned a new group and envbus, so these are made available to the Function through arguments. If an OSCresponderNode or releaseFunc are needed for each re-triggered event, they should be assigned inside the Function:</p>
<p class="p2"><br></p>
<p class="p6"><span class="s6">SynthDef</span>(<span class="s7">\trig</span>, {<span class="s6">arg</span> id, val;</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="s6">SendTrig</span>.kr(<span class="s6">Impulse</span>.kr(10), id, val);</p>
<p class="p6"><span class="Apple-tab-span">	</span>}).load(s);</p>
<p class="p9"><span class="Apple-tab-span">	</span></p>
<p class="p6"><span class="s6">SynthDef</span>(<span class="s7">\singrain</span>, {<span class="s6">arg</span> freq, amp, dur, envbus;</p>
<p class="p10"><span class="s5"><span class="Apple-tab-span">	</span></span>OffsetOut<span class="s5">.ar(0,<span class="Apple-converted-space"> </span></span></p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s6">Pan2</span>.ar(</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s6">SinOsc</span>.ar(freq, 0, amp) *<span class="Apple-converted-space"> </span></p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s6">EnvGen</span>.kr(<span class="s6">Env</span>.sine(dur, amp), doneAction: 2) *</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s6">In</span>.kr(envbus),</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>-1.0.rrand(1.0)</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>)</p>
<p class="p11"><span class="s5"><span class="Apple-tab-span">	</span>) </span>// read off the overall env control of the ProcMod</p>
<p class="p6">}).load(s);</p>
<p class="p9"><br></p>
<p class="p6">i = 0;</p>
<p class="p6">s.boot;</p>
<p class="p6">a = <span class="s6">ProcMod</span>.new(<span class="s6">Env</span>([0, 1, 0], [1, 3], <span class="s7">\sin</span>, 1), server: s);</p>
<p class="p11">// use a function. This one returns the Task. group and envbus are passed in as args</p>
<p class="p6">a.function_({<span class="s6">arg</span> group, envbus, server;</p>
<p class="p6"><span class="Apple-tab-span">	</span>a.responder_(</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s6">OSCresponderNode</span>(a.server.addr, <span class="s7">'/tr'</span>, {<span class="s6">arg</span> time, resp, msg;</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>(msg[2] == group).if({msg[3].postln})</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>})</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>);</p>
<p class="p10"><span class="s5"><span class="Apple-tab-span">	</span></span>Task<span class="s5">({</span></p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>s.sendMsg(<span class="s7">\s_new</span>, <span class="s7">\trig</span>, a.server.nextNodeID, 0, group, <span class="s7">\id</span>, group,</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s7">\val</span>, i);</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>i = i + 1;</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s6">inf</span>.do({</p>
<p class="p11"><span class="s5"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span></span>// start a new synth... run it inside this ProcMod's group,</p>
<p class="p11"><span class="s5"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span></span>// and read control values off the envbus</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>server.sendMsg(<span class="s7">\s_new</span>, <span class="s7">\singrain</span>, server.nextNodeID, 0,<span class="Apple-converted-space"> </span></p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>group, <span class="s7">\freq</span>, 440.rrand(880) * i, <span class="s7">\amp</span>, 0.1, <span class="s7">\dur</span>, 5,<span class="Apple-converted-space"> </span></p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s7">\envbus</span>, envbus);</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>0.05.wait;</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>});</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>});</p>
<p class="p6"><span class="Apple-tab-span">	</span>});</p>
<p class="p9"><br></p>
<p class="p11"><span class="s5">a.play; </span>// play the ProcMod</p>
<p class="p11">// release the current event, and start a new one immediately. These will overlap.</p>
<p class="p11"><span class="s5">a.release; a.play; </span>// watch the posted values from the OSCresponderNode</p>
<p class="p6">a.release;</p>
<p class="p9"><br></p>
<p class="p4"><b>ProcEvents</b></p>
<p class="p12"><br></p>
<p class="p3"><b>Class Methods</b></p>
<p class="p2"><br></p>
<p class="p3"><b>*new(events, amp, initmod, killmod, id, server)</b></p>
<p class="p2"><br></p>
<p class="p3"><b><span class="Apple-tab-span">	</span>events -</b> an array of events (ProcMods or a function) to play / release<span class="Apple-converted-space">  </span>in the following format:</p>
<p class="p3"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>[ProcMod, ProcMod.id to release]</p>
<p class="p3"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>both the events to play and release may also be arrays, or nil.</p>
<p class="p3"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>If the event is a function, realize that it is best to be a single shot type of thing, you won't be able to</p>
<p class="p3"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>access it later (to stop a loop, for instance). So, make sure it is something that you set to run</p>
<p class="p3"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>or execute, then can forget about completely.</p>
<p class="p3"><span class="Apple-tab-span">	</span><b>amp - </b>an amplitude scaler for everything running in the ProcEvents instance.</p>
<p class="p3"><span class="Apple-tab-span">	</span><b>initmod -</b> a ProcMod to be evaluated when the first event is called, regardless of event number. Useful for</p>
<p class="p3"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>allocating buffers or persistant synths.</p>
<p class="p3"><b><span class="Apple-tab-span">	</span>killmod - </b>a ProcMod to be evaluated when this instance of ProcEvents is killed. Useful for freeing buffers</p>
<p class="p3"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>and killing persistant synths.</p>
<p class="p3"><b><span class="Apple-tab-span">	</span>id - </b>a \symbol or "string" to identify this instance of ProcEvents</p>
<p class="p3"><span class="Apple-tab-span">	</span><b>server -</b> an instance of Server to run this ProcMod on. Useful for remote servers.<span class="Apple-converted-space"> </span></p>
<p class="p3"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>Defaults to Server.default.<span class="Apple-tab-span">	</span></p>
<p class="p2"><br></p>
<p class="p3"><b>Instance methods</b></p>
<p class="p2"><br></p>
<p class="p3"><b>play( eventindex ) -</b> plays and releases the events at index in the events array. If initmod has not been<span class="Apple-converted-space"> </span></p>
<p class="p3"><span class="Apple-tab-span">	</span>executed, it will be.</p>
<p class="p2"><br></p>
<p class="p3"><b>next - </b>will play and release the next event is the events array. Starts at 0. If initmod has not been executed, it</p>
<p class="p3"><span class="Apple-tab-span">	</span>will be.</p>
<p class="p2"><span class="Apple-tab-span">	</span></p>
<p class="p3"><b>releaseAll -</b> releases all running ProcMods EXCEPT the initmod.</p>
<p class="p2"><br></p>
<p class="p3"><b>reset - </b>releases all running ProcMods and resets the system to evaluate initmod again.</p>
<p class="p2"><br></p>
<p class="p3"><b>killAll - </b>kill this instance of ProcEvents. Frees everything.</p>
<p class="p2"><br></p>
<p class="p3"><b>starttime( id ) - </b>returns the starttime of the ProcMod with 'id' in relation to the starttime of ProcEvents' first event.<span class="Apple-converted-space"> </span></p>
<p class="p3"><span class="Apple-tab-span">	</span>d should be a \symbol or "string". If 'id' is nil, the time of the first event of this instance of ProcEvents</p>
<p class="p3"><span class="Apple-tab-span">	</span>(according to Main.elapsedTime) is returned.</p>
<p class="p2"><span class="Apple-tab-span">	</span></p>
<p class="p3"><b>now( id ) -</b> returns the current time in reference to the starttime of 'id'. 'id' should be a \symbol or "string". If 'id' is<span class="Apple-converted-space"> </span></p>
<p class="p3"><span class="Apple-tab-span">	</span>nil, the reference will be the ProcEvents starttime itself.</p>
<p class="p2"><span class="Apple-tab-span">	</span></p>
<p class="p3"><b>perfGUI - </b>creates a GUI with basic ProcEvents controls to perform an instance of ProcEvents.<span class="Apple-converted-space"> </span></p>
<p class="p2"><br></p>
<p class="p3"><b>pracGUI - </b>creates a GUI with basic ProcMod controls and a perfGUI for rehearsal purposes.</p>
<p class="p2"><span class="Apple-tab-span">	</span></p>
<p class="p3"><b>pedalTrig( pedalbus, headroom, trigwindow, testdur ) - </b>listens to pedalbus for Amplitude triggers. This is<span class="Apple-converted-space"> </span></p>
<p class="p3"><span class="Apple-tab-span">	</span>fairly specialized. I use a quater inch keyboard sustain pedal (a ground switch). When pedalTrig is<span class="Apple-converted-space"> </span></p>
<p class="p3"><span class="Apple-tab-span">	</span>invoked, an OSCresponderNode is started that listens for a noise floor for testdur seconds. An average<span class="Apple-converted-space"> </span></p>
<p class="p3"><span class="Apple-tab-span">	</span>reading is taken and is stored as a basevalue. When the pedal is pressed, a spike in amplitude is created.<span class="Apple-converted-space"> </span></p>
<p class="p3"><span class="Apple-tab-span">	</span>If the spike is within basevalue * headroom, the next event is called. Some tuning should be done to find</p>
<p class="p3"><span class="Apple-tab-span">	</span>a headroom value that will work reliably. Triggers are limited to one trigger in every trigwindow seconds.</p>
<p class="p3"><span class="Apple-tab-span">	</span>The server MUST be booted before .pedalTrig is called.</p>
<p class="p2"><br></p>
<p class="p3"><b>TO DO: create a way to store values from the pracGUI to be re-used for later performances.</b></p>
<p class="p2"><br></p>
<p class="p3"><b>Examples:</b></p>
<p class="p2"><br></p>
<p class="p6"><span class="s6">SynthDef</span>(<span class="s7">\singrain</span>, {<span class="s6">arg</span> freq, amp, dur, procbus, outbus = 0;</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="s6">Out</span>.ar(outbus,<span class="Apple-converted-space"> </span></p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s6">Pan2</span>.ar(</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s6">SinOsc</span>.ar(freq, 0, amp) *<span class="Apple-converted-space"> </span></p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s6">EnvGen</span>.kr(<span class="s6">Env</span>.sine(dur, amp), doneAction: 2) *</p>
<p class="p11"><span class="s5"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span></span><span class="s6">In</span><span class="s5">.kr(procbus), </span>// read off the overall env control of the ProcMod</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>Rand(-1.0, 1.0)</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>)</p>
<p class="p6"><span class="Apple-tab-span">	</span>)<span class="Apple-converted-space"> </span></p>
<p class="p6">}).load(s);</p>
<p class="p9"><br></p>
<p class="p6">(</p>
<p class="p11">// create a ProcMod... feed the function in at init time</p>
<p class="p6">a = <span class="s6">ProcMod</span>.new(<span class="s6">Env</span>([0, 1, 0], [1, 1], <span class="s7">\sin</span>, 1), 0.02,</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>function: {<span class="s6">arg</span> group, envbus, server;</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s6">Task</span>({</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s6">inf</span>.do({</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>s.sendMsg(<span class="s7">\s_new</span>, <span class="s7">\singrain</span>, s.nextNodeID, 0, group,</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s7">\freq</span>, 440.rrand(880), <span class="s7">\amp</span>, 1, <span class="s7">\dur</span>, 0.2,<span class="Apple-converted-space"> </span></p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s7">\procbus</span>, envbus);</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>0.05.wait;</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>})</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>});</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>}</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>);</p>
<p class="p9"><br></p>
<p class="p11">// create a ProcMod... set the function after init time</p>
<p class="p6">b = <span class="s6">ProcMod</span>.new(<span class="s6">Env</span>([0, 1, 0], [1, 1], <span class="s7">\sin</span>, 1), 0.02)</p>
<p class="p6"><span class="Apple-tab-span">	</span>.function_({<span class="s6">arg</span> group, envbus;</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s6">Task</span>({</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s6">inf</span>.do({</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>s.sendMsg(<span class="s7">\s_new</span>, <span class="s7">\singrain</span>, s.nextNodeID, 0, group,</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s7">\freq</span>, 4400.rrand(8800), <span class="s7">\amp</span>, 1, <span class="s7">\dur</span>, 0.2,<span class="Apple-converted-space"> </span></p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s7">\procbus</span>, envbus);</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>0.05.wait;</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>})</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>});</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>});<span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span></p>
<p class="p9"><br></p>
<p class="p11">// create the ProcEvents to run the above ProcMods<span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span></p>
<p class="p10"><span class="s5">e = </span>ProcEvents<span class="s5">.new(</span></p>
<p class="p11"><span class="s5"><span class="Apple-tab-span">	</span></span>// an array of event / release arrays</p>
<p class="p6"><span class="Apple-tab-span">	</span>[</p>
<p class="p11"><span class="s5"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span></span>// run 'a'</p>
<p class="p6"><span class="s8">/* 0 */</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>[a, <span class="s6">nil</span>],</p>
<p class="p11"><span class="s5"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span></span>// run 'b'</p>
<p class="p6"><span class="s8">/* 1 */</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>[b, <span class="s6">nil</span>],</p>
<p class="p11"><span class="s5"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span></span>// kill ev1 and ev2</p>
<p class="p6"><span class="s8">/* 2 */</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>[<span class="s6">nil</span>, [a, b]]</p>
<p class="p6"><span class="Apple-tab-span">	</span>], 1);</p>
<p class="p9"><br></p>
<p class="p6">)</p>
<p class="p9"><br></p>
<p class="p11">// open a GUI to perform the above events</p>
<p class="p6">e.perfGUI;</p>
<p class="p9"><br></p>
<p class="p11">// a more complex example, using function to create ProcMods, and feeding the<span class="Apple-converted-space"> </span></p>
<p class="p11">// evaluated form of those functions into ProcEvents.</p>
<p class="p6">(</p>
<p class="p6">a = {<span class="s6">arg</span> id, amp, env, high, low, winsize, overlaps;</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="s6">var</span> proc;</p>
<p class="p6"><span class="Apple-tab-span">	</span>proc = <span class="s6">ProcMod</span>.new(env, amp, id: id);</p>
<p class="p6"><span class="Apple-tab-span">	</span>proc.function_({<span class="s6">arg</span> group, envbus, server;</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s6">Task</span>({</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s6">inf</span>.do({</p>
<p class="p11"><span class="s5"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span></span>// start a new synth... run it inside this ProcMod's group,</p>
<p class="p11"><span class="s5"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span></span>// and read control values off the envbus</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>server.sendMsg(<span class="s7">\s_new</span>, <span class="s7">\singrain</span>, server.nextNodeID, 0, group,</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s7">\freq</span>, high.rrand(low), <span class="s7">\amp</span>, 1, <span class="s7">\dur</span>, winsize,<span class="Apple-converted-space"> </span></p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s7">\procbus</span>, envbus);</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>(winsize / overlaps).wait;</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>})</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>});</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>});</p>
<p class="p6"><span class="Apple-tab-span">	</span>};</p>
<p class="p9"><br></p>
<p class="p6">e = <span class="s6">ProcEvents</span>.new([</p>
<p class="p6"><span class="s8">/* 0 */</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>[a.value(<span class="s7">\ev1</span>, 0.1, <span class="s6">Env</span>([0, 1, 0], [2, 10], <span class="s7">\sin</span>, 1), 440, 880, 0.3, 8),</p>
<p class="p11"><span class="s5"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span></span><span class="s6">nil</span><span class="s5">], </span>// create \ev1, release nothing</p>
<p class="p6"><span class="s8">/* 1 */</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>[a.value(<span class="s7">\ev2</span>, 0.1, <span class="s6">Env</span>([0, 1, 0], [1, 10], <span class="s7">\sin</span>, 1), 2200, 4400, 0.2, 8),</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s6">nil</span>],</p>
<p class="p6"><span class="s8">/* 2 */</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>[a.value(<span class="s7">\ev3</span>, 0.1, <span class="s6">Env</span>([0, 1, 0.5, 2, 0], [1, 1, 1, 1], <span class="s7">\sin</span>, 1), 100,</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>10000, 1, 4),</p>
<p class="p11"><span class="s5"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>[</span><span class="s7">\ev1</span><span class="s5">, </span><span class="s7">\ev2</span><span class="s5">]], </span>// release ev1 and ev2</p>
<p class="p11">/* 3 */<span class="s5"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>[</span><span class="s6">nil</span><span class="s5">, </span><span class="s7">\ev3</span><span class="s5">]</span></p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>], 0.dbamp, id: <span class="s9">"test"</span>);</p>
<p class="p9"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span></p>
<p class="p6">)</p>
<p class="p9"><br></p>
<p class="p6">e.perfGUI;</p>
<p class="p9"><br></p>
<p class="p11">/* A simple example showing the pedalTrig function. The headroom value is high so you</p>
<p class="p11">can see how it works with an internval mic ... snap your fingers and the GUI should advance */</p>
<p class="p9"><br></p>
<p class="p6">(</p>
<p class="p6">s=<span class="s6">Server</span>.internal.boot;</p>
<p class="p6">s.waitForBoot({</p>
<p class="p6"><span class="Apple-tab-span">	</span>a = <span class="s6">ProcEvents</span>.new([</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>[{<span class="s9">"event1"</span>.postln}, <span class="s6">nil</span>],</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>[{<span class="s9">"event2"</span>.postln}, <span class="s6">nil</span>],</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>[{<span class="s9">"event3"</span>.postln}, <span class="s6">nil</span>],</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>[{<span class="s9">"event4"</span>.postln}, <span class="s6">nil</span>],</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>[{<span class="s9">"event5"</span>.postln}, <span class="s6">nil</span>],</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>[{<span class="s9">"event6"</span>.postln}, <span class="s6">nil</span>],</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>[{<span class="s9">"event7"</span>.postln}, <span class="s6">nil</span>],</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>[{<span class="s9">"event8"</span>.postln}, <span class="s6">nil</span>],</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>[{<span class="s9">"event9"</span>.postln}, <span class="s6">nil</span>]</p>
<p class="p6"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>], 1, <span class="s6">nil</span>, <span class="s6">nil</span>, <span class="s9">"test"</span>, s);</p>
<p class="p9"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span></p>
<p class="p11"><span class="s5"><span class="Apple-tab-span">	</span></span>// .pedalTrig(pedalbus, tolerance, testdur)</p>
<p class="p11"><span class="s5"><span class="Apple-tab-span">	</span></span>// we'll make the pedalbus the inbus of the pedal</p>
<p class="p11"><span class="s5"><span class="Apple-tab-span">	</span></span>// pedalTrig will listen for the average amount of noise on the bus</p>
<p class="p11"><span class="s5"><span class="Apple-tab-span">	</span></span>// then looks for triggers above noise * headroom</p>
<p class="p11"><span class="s5"><span class="Apple-tab-span">	</span></span>// 5 might be high... but it is handy for using the internal mic for a test</p>
<p class="p11"><span class="s5"><span class="Apple-tab-span">	</span></span>// this really depends on the noise floor of your pedal (I've used values in<span class="Apple-converted-space"> </span></p>
<p class="p11"><span class="s5"><span class="Apple-tab-span">	</span></span>// the hundreds even)</p>
<p class="p6"><span class="Apple-tab-span">	</span>a.pedalTrig(s.options.numOutputBusChannels, 10, 2);</p>
<p class="p9"><span class="Apple-tab-span">	</span></p>
<p class="p6"><span class="Apple-tab-span">	</span>a.perfGUI;</p>
<p class="p6"><span class="Apple-tab-span">	</span>})</p>
<p class="p6">)</p>
<p class="p9"><br></p>
<p class="p6">s.scope</p>
</body>
</html>
